find_package(PkgConfig REQUIRED)
pkg_check_modules(JSONCPP jsoncpp)
message("json libraries:" ${JSONCPP_LIBRARIES})
link_libraries(${JSONCPP_LIBRARIES})
# target_link_libraries(cpp-ethereum ${JSONCPP_LIBRARIES})


if(JSONCPP_FOUND)
    message("INFO: we found LibJsoncpp on your pc.")
    message(Jsoncpp_FOUND = ${JSONCPP_FOUND}) 
    message(Jsoncpp_INCLUDE_DIR = ${JSONCPP_INCLUDE_DIR}) 
    message(Jsoncpp_INCLUDE_DIRS = ${JSONCPP_INCLUDE_DIRS}) 
    message(Jsoncpp_LIBRARY = ${JSONCPP_LIBRARY})
else(JSONCPP_FOUND)
    message("ERROR: we couldn't find LibJsoncpp on your pc")
endif(JSONCPP_FOUND)



set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB")

aux_source_directory(. SRC_LIST)

file(GLOB HEADERS "*.h")

add_library(ethereum ${SRC_LIST} ${HEADERS})

target_link_libraries(ethereum ${Boost_REGEX_LIBRARIES} ${JSONCPP_LIBRARIES})
find_package(Boost QUIET REQUIRED COMPONENTS regex)
find_package(Dev)
find_package(Eth)

target_include_directories(ethereum PRIVATE ..)
target_include_directories(ethereum PRIVATE ../utils)
target_link_libraries(ethereum ${Boost_REGEX_LIBRARIES})
target_link_libraries(ethereum ${Eth_ETHCORE_LIBRARIES})
target_link_libraries(ethereum ${Eth_EVM_LIBRARIES})

if (NOT EMSCRIPTEN)
	target_link_libraries(ethereum ${Dev_P2P_LIBRARIES})
	target_link_libraries(ethereum ${Dev_DEVCRYPTO_LIBRARIES})
endif()

if (EVMJIT)
	target_link_libraries(ethereum ${Eth_EVMJIT_LIBRARIES})
endif()

install(TARGETS ethereum RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
